package example.dao;

import example.pojo.Type;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface TypeDao {
    @Select("select * from type")
    public List<Type> selectAll();

    @Select("select * from type where id = #{id}")
    Type selectById(int id);
    //添加
    @Insert("insert into type(name) values(#{name})")
    @Options(useGeneratedKeys = true,keyProperty = "id")
    public int add(Type type);
    //更改
    @Update("update type set name = #{name} where id = #{id}")
    public int update(Type type);
}
